var express = require('express');
const db = require('../public/javascripts/db');
var router = express.Router();

/* GET home page. */
router.put('/', function (req, res, next) {
    let info = req.body;
    let sql = "update express set express_code=?,express_owner=?,express_num=?,express_status=?,express_company=?,express_address=? where express_id=?";
    let data = [info.express_code, info.express_owner, info.express_num, info.express_status, info.express_company, info.express_address,info.express_id];
    db(sql, data, (result) => {
        if (result.affectedRows == 1) {
            res.json({
                code: 200,
                message: "修改快递信息成功",
                data: result
            })
        } else {
            res.json({
                code: 500,
                message: "服务器错误",
            })
        }
    })
});

module.exports = router;